package controller;

import com.jfinal.aop.Inject;
import com.jfinal.plugin.activerecord.Db;
import com.jfinal.plugin.activerecord.Record;
import io.jboot.app.JbootApplication;
import io.jboot.test.codegen.model.User;
import io.jboot.test.codegen.service.UserService;
import io.jboot.web.controller.JbootController;
import io.jboot.web.controller.annotation.RequestMapping;

import java.util.Arrays;
import java.util.List;

/**
 * @program: gulimall
 * @description:d
 * @author: 江天赐
 * @create: 2023-05-23 18:42
 */
@RequestMapping("/")
public class IndexController extends JbootController {
    @Inject
    private UserService userService;

    public void index() {
        renderText("Hello World Jboot");
    }

    public void dbtest() {
        List<Record> records = Db.find("select * from user");
        renderText(Arrays.toString(records.toArray()));
    }

//    public void user() {
//        List<User> users = userService.findAll();
//        renderText(Arrays.toString(users.toArray()));
//    }

    public static void main(String[] args) {
        JbootApplication.run(args);
    }

}
